# Contributor: Jonas <3426-spameier@users.gitlab.alpinelinux.org>
# Maintainer: Jonas <3426-spameier@users.gitlab.alpinelinux.org>
pkgname=py3-mbedtls
_pyname=python-mbedtls
pkgver=2.8.0
pkgrel=0
pkgdesc="hash, hmac, RSA, ECC, X.509, TLS, DTLS, handshakes, and secrets with an mbed TLS back end"
url="https://github.com/Synss/python-mbedtls"
arch="all"
license="MIT"
depends="
	mbedtls
	py3-certifi
	py3-typing-extensions
	"
makedepends="
	cython
	mbedtls-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	py3-pytest-repeat
	py3-pytest-timeout
	py3-readme_renderer
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Synss/python-mbedtls/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python3.*/site-packages/tests/ # remove tests
}

sha512sums="
84f4b91115694d8e71496122fd9bcccec34571cf3ac7e520ed42d883cdf0dbe701d7acae3e8e5691e6dd99629c6896acba998f6bb8d96e9a166baba92b6ddaae  py3-mbedtls-2.8.0.tar.gz
"
